package com.javaweb.entity;

import java.util.Date;
import java.util.Objects;

/**
 * Commment made by user for some teacher
 */
public class Comment {
    private int id ;
    private int teacherId ;
    private int userId ;
    private Date commentTime ;
    private String comment ;

    public Comment() {
    }

    public Comment(int teacherId, int userId, String comment) {
        this.teacherId = teacherId;
        this.userId = userId;
        this.comment = comment;
        this.commentTime = new Date() ;
    }

    public Comment(int teacherId, int userId, Date commentTime, String comment) {
        this.teacherId = teacherId;
        this.userId = userId;
        this.commentTime = commentTime;
        this.comment = comment;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(int teacherId) {
        this.teacherId = teacherId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public Date getCommentTime() {
        return commentTime;
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Comment)) return false;
        Comment comment1 = (Comment) o;
        return id == comment1.id &&
                teacherId == comment1.teacherId &&
                userId == comment1.userId &&
                commentTime.equals(comment1.commentTime) &&
                comment.equals(comment1.comment);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, teacherId, userId, commentTime, comment);
    }
}
